//
//  LGSetPasswordController.m
//  HeartDiseaseManage
//
//  Created by 1234 on 2023/2/13.
//  设置登录密码 -- 首次设置密码

#import "LGSetPasswordController.h"
#import "LGAccountInputView.h"
@interface LGSetPasswordController ()
/**   */
@property (nonatomic , strong)UILabel *titleLabel;
/**   */
@property (nonatomic , strong)LGAccountInputView *topView;
/**   */
@property (nonatomic , strong)LGAccountInputView *bottomView;
/**   */
@property (nonatomic , strong)UIButton *sureBtn;
@end

@implementation LGSetPasswordController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.title = @"设置登录密码";
    self.view.backgroundColor = [UIColor whiteColor];
    [self.view addSubview:self.titleLabel];
    [self.view addSubview:self.topView];
    [self.view addSubview:self.bottomView];
    [self.view addSubview:self.sureBtn];
}

//确定
-(void)sureBtnAction{
    [self.navigationController popViewControllerAnimated:YES];
}

-(UILabel *)titleLabel{
    if(!_titleLabel){
        _titleLabel = [UILabel lableWithText:@"设置密码后，\n可使用 手机号+密码 登录" colorString:@"#999999" textFont:LGFont(16) textAlignment:NSTextAlignmentLeft lines:2];
        _titleLabel.frame = CGRectMake(viewPix(19), viewPix(34), viewPix(250), viewPix(50));
        NSMutableAttributedString *attStr = [[NSMutableAttributedString alloc]initWithString:@"设置密码后，\n可使用 手机号+密码 登录"];
        NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init];
        paragraphStyle.lineBreakMode = NSLineBreakByTruncatingTail;
        paragraphStyle.alignment = NSTextAlignmentLeft;
        [paragraphStyle setLineSpacing:5];
        [attStr addAttributes:@{NSFontAttributeName:LGFontWeight(16, UIFontWeightMedium),NSForegroundColorAttributeName:[UIColor colorWithString:@"#2E8FFF"]} range:NSMakeRange(11, 6)];
        [attStr addAttribute:NSParagraphStyleAttributeName value:paragraphStyle range:NSMakeRange(0, attStr.length)];
        _titleLabel.attributedText = attStr;
    }
    return _titleLabel;
}

-(LGAccountInputView *)topView{
    if(!_topView){
        _topView = [[LGAccountInputView alloc] initWithFrame:CGRectMake(viewPix(16), kMaxY(self.titleLabel.frame)+viewPix(50), Screen_W-viewPix(32), viewPix(56))];
//        [_topView setShadoWithColor:@"#B3C5D9" offset:CGSizeMake(0, 2) opacity:0.2 radius:10];
//        _topView.backgroundColor = [UIColor whiteColor];
        _topView.type = @"password";
        _topView.contenTF.attributedPlaceholder = [@"请输入6-20位数字和字母组合的密码" attributeString:@{NSFontAttributeName:LGFont(14),NSForegroundColorAttributeName:[UIColor colorWithString:@"#999999"]}];
//        _topView.hasBorder = NO;
    }
    return _topView;
}

-(LGAccountInputView *)bottomView{
    if(!_bottomView){
        _bottomView = [[LGAccountInputView alloc] initWithFrame:CGRectMake(viewPix(16), kMaxY(self.topView.frame)+viewPix(16), Screen_W-viewPix(32), viewPix(56))];
//        [_bottomView setShadoWithColor:@"#B3C5D9" offset:CGSizeMake(0, 2) opacity:0.2 radius:10];
//        _bottomView.backgroundColor = [UIColor whiteColor];
        _bottomView.type = @"password";
        _bottomView.contenTF.attributedPlaceholder = [@"请再次输入密码" attributeString:@{NSFontAttributeName:LGFont(14),NSForegroundColorAttributeName:[UIColor colorWithString:@"#999999"]}];
//        _bottomView.hasBorder = NO;
    }
    return _bottomView;
}

-(UIButton *)sureBtn{
    if(!_sureBtn){
        _sureBtn = [UIButton buttonWithTitle:@"确定" topMargin:kMaxY(self.bottomView.frame)+viewPix(140)];
        [_sureBtn addTarget:self action:@selector(sureBtnAction) forControlEvents:UIControlEventTouchUpInside];
    }
    return _sureBtn;
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
